package com.ruoyi.project.warehouse.service.impl;

import java.util.List;

import com.ruoyi.project.warehouse.domain.InventoryTypeVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.warehouse.mapper.WareInventoryTypeMapper;
import com.ruoyi.project.warehouse.domain.WareInventoryType;
import com.ruoyi.project.warehouse.service.IWareInventoryTypeService;

/**
 * 物品类别Service业务层处理
 *
 * @author you
 * @date 2022-09-03
 */
@Service
public class WareInventoryTypeServiceImpl implements IWareInventoryTypeService
{
    @Autowired
    private WareInventoryTypeMapper wareInventoryTypeMapper;

    /**
     * 查询物品类别
     *
     * @param id 物品类别主键
     * @return 物品类别
     */
    @Override
    public WareInventoryType selectWareInventoryTypeById(Long id)
    {
        return wareInventoryTypeMapper.selectWareInventoryTypeById(id);
    }

    /**
     * 查询1级类别：种类
     *
     * @return 物品类别集合
     */
    public List<InventoryTypeVo> allKindType(){
        return wareInventoryTypeMapper.allKindType();
    }


    /**
     * 根据父类id查询其下子类别
     *
     * @param parentId 父类id
     * @return 物品类别集合
     */
    public List<InventoryTypeVo> findByParentId(Long parentId){
        return wareInventoryTypeMapper.findByParentId(parentId);
    }

    /**
     * 查询物品类别列表
     *
     * @param wareInventoryType 物品类别
     * @return 物品类别
     */
    @Override
    public List<WareInventoryType> selectWareInventoryTypeList(WareInventoryType wareInventoryType)
    {
        return wareInventoryTypeMapper.selectWareInventoryTypeList(wareInventoryType);
    }

    /**
     * 新增物品类别
     *
     * @param wareInventoryType 物品类别
     * @return 结果
     */
    @Override
    public int insertWareInventoryType(WareInventoryType wareInventoryType)
    {
        return wareInventoryTypeMapper.insertWareInventoryType(wareInventoryType);
    }

    /**
     * 修改物品类别
     *
     * @param wareInventoryType 物品类别
     * @return 结果
     */
    @Override
    public int updateWareInventoryType(WareInventoryType wareInventoryType)
    {
        return wareInventoryTypeMapper.updateWareInventoryType(wareInventoryType);
    }

    /**
     * 批量删除物品类别
     *
     * @param ids 需要删除的物品类别主键
     * @return 结果
     */
    @Override
    public int deleteWareInventoryTypeByIds(Long[] ids)
    {
        return wareInventoryTypeMapper.deleteWareInventoryTypeByIds(ids);
    }

    /**
     * 删除物品类别信息
     *
     * @param id 物品类别主键
     * @return 结果
     */
    @Override
    public int deleteWareInventoryTypeById(Long id)
    {
        return wareInventoryTypeMapper.deleteWareInventoryTypeById(id);
    }
}
